/*
 *  Copyright 2021-2025 Michael T. Richter as Half-Baked Software
 *  This program is free software. It comes without any warranty, to the extent
 *  permitted by applicable law. You can redistribute it and/or modify it under
 *  the terms of the Do What The Fuck You Want To Public License, Version 2, as
 *  published by Sam Hocevar. See the file COPYING or http://www.wtfpl.net/ for
 *  more details.
 */

#include <stdbool.h>

#include "co.h"
#include "co_impl.h"

co_t co_active = NULL;

// terminate a coroutine, not public but must be called below
// when a coroutine ends
void co_halt_impl(void)
{
    while (true)
    {
        co_yield_impl(&co_active->stack_pointer, NULL);
    }
}
